<?php
class photo_view extends SClass {

    public function process() {
        try {
            $id = $this->getArgument('id');
            $photoAlbum = Triumph::Get()->getMediaService()->getPhotoAlbumById($id);
            $this->setValue('name', $photoAlbum->getName());
            $this->setValue('description', $photoAlbum->getDescription());
            $this->setValue('count', $photoAlbum->getCount());
            $this->setValue('cdate', DateTime_Formatter::DatePhonetic($photoAlbum->getCdate()));
            $photo = Triumph::Get()->getMediaService()->getPhotoByAlbumId($id);
            $photo->setLimitCount(24);
            $a = array();
            while ($x = $photo->getNext()) {
                $a[] = array(
                    'id' => $x->getId(),
                    'image' => $x->makeImageThumb(232,160, 'crop'),
                    'bigImage' => $x->makeBigImageThumb(),
                    'name' => $x->getName()
                );
            }
            PackageLoader::Get()->import('JSLightview');
            $this->setValue('photoArray', $a);
        } catch (Exeption $e) {
            Engine::GetQuery()->setContentNotFound();
        }
    }

}